#include <iostream>
#include <vector>
#include <unordered_map>

using namespace std;

// https://leetcode.cn/problems/two-sum/?envType=study-plan-v2&envId=top-100-liked

class Solution {
public:
    vector<int> twoSum(vector<int>& nums, int target) {
        vector<int> ans;
        unordered_map<int, int> recordNum;
        for (int i = 0; i < nums.size(); i++)
        {
            if(recordNum.find(target - nums[i]) != recordNum.end()){
                ans.push_back(i);
                ans.push_back(recordNum[target - nums[i]]);
                break;
            }
            recordNum[nums[i]] = i;
        }
        return ans;
    }
};

int main()
{
    return 0;
}